.TH "ggi_pixelformat" 3 "2007-06-24" "libggi-current" GGI
.SH NAME
\fBggi_pixelformat\fR : LibGGI pixel format description
.SH SYNOPSIS
.nb
.nf
#include <ggi/ggi.h>

typedef struct {
      int             depth;          /* Number of significant bits */
      int             size;           /* Physical size in bits */

      /* 
       * Simple and common things first :
       * 
       * Usage of the mask/shift pairs:
       * If new_value is the _sizeof(ggi_pixel)*8bit_ value of the thing 
       * you want to set, you do
       *
       * *pointer &= ~???_mask;               // Mask out old bits 
       * *pointer |= (new_value>>shift) & ???_mask;
       * 
       * The reason to use 32 bit and "downshifting" is alignment
       * and extensibility. You can easily adjust to other datasizes
       * with a simple addition ...
       */
      
      /* Simple colors:
       */
      ggi_pixel       red_mask;       /* Bitmask of red bits */
      int             red_shift;      /* Shift  for red bits */

      ggi_pixel       green_mask;     /* Bitmask of green bits */
      int             green_shift;    /* Shift  for green bits */

      ggi_pixel       blue_mask;      /* Bitmask of blue bits */
      int             blue_shift;     /* Shift  for blue bits */

      /* A few common attributes :
       */
      ggi_pixel       alpha_mask;     /* Bitmask of alphachannel bits */
      int             alpha_shift;    /* Shift  for alpha bits */

      ggi_pixel       clut_mask;      /* Bitmask of bits for the clut */
      int             clut_shift;     /* Shift  for bits for the clut*/

      ggi_pixel       fg_mask;        /* Bitmask of foreground color */
      int             fg_shift;       /* Shift  for foreground color */

      ggi_pixel       bg_mask;        /* Bitmask of background color */
      int             bg_shift;       /* Shift  for background color */

      ggi_pixel       texture_mask;   /* Bitmask of the texture (for
                                         textmodes - the actual character) */
      int             texture_shift;  /* Shift  for texture */

      /*
       * Now if this doesn't suffice you might want to parse the following
       * to find out what each bit does:
       */

      uint32_t                bitmeaning[sizeof(ggi_pixel)*8];

      uint32_t                flags;          /* Pixelformat flags */

      uint32_t                stdformat;      /* Standard format identifier */
      /* This one has only one use for the usermode application:
       * To quickly check, if two buffers are identical. If both
       * stdformats are the same and _NOT_ 0 (which means "WEIRD"),
       * you may use things like memcpy between them which will have
       * the desired effect ...
       */
      
} ggi_pixelformat;

/* Pixelformat flags */
#define GGI_PF_REVERSE_ENDIAN 0x01
#define GGI_PF_HIGHBIT_RIGHT  0x02
#define GGI_PF_HAM            0x04
#define GGI_PF_EXTENDED               0x08
.fi

.SH DESCRIPTION
This structure describes the internal format of pixel values for a visual.
.SH SEE ALSO
\f(CWggiGetPixelFormat(3)\fR
